package com.neusoft.newelm.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import com.neusoft.newelm.bean.Role;

/**
 * 
 * @Repository
 * 
 * @author chens
 *
 */
public interface RoleMapper extends BaseMapper<Role> {
	/**
	 * 新增
	 * 
	 * @param object
	 * 
	 * @return boolean
	 */
	@Insert("insert into role(roleName) values(#{roleName})")
	public boolean add(Role object);

	/**
	 * 修改
	 * 
	 * @param object
	 * 
	 * @return boolean
	 */
	@Update("update role set roleName=#{roleName} where roleId=#{id}")
	public boolean edit(Role object);

	/**
	 * 删除
	 * 
	 * @param id
	 * 
	 * @return boolean
	 */
	@Delete("delete from role where roleId=#{id}")
	public boolean deleteById(Integer id);

	/**
	 * 根据主键查询对象
	 * 
	 * 
	 * @param id
	 * 
	 * @return
	 */
	@Select("select roleId,roleName from role where roleId=#{id}")
	public Role findById(Integer id);

}
